package com.ebelter.myehc.ui.fragments.bracelet;

import android.os.Bundle;

import android.widget.ListView;
import android.widget.TextView;

import com.ebelter.btcomlib.bases.fragment.BaseFragment;
import com.ebelter.btcomlib.models.bluetooth.products.bracelet.bean.WalkBean;

import com.ebelter.btcomlib.utils.ViewUtils;

import com.ebelter.myehc.R;
import com.ebelter.myehc.adapters.BraBuShuAdapter;
import com.ebelter.myehc.beans.BraTodayData;

import com.ebelter.myehc.utils.EHCCommonUtils;


/**
 * 手环 步数
 */

public class BRA_BS_Fragment extends BaseFragment {
    public static final String TAG = "BRA_Fragment";
    @Override
    protected int setLayoutResouceId() {
        return R.layout.fragment_bra_bsh;
    }


    private TextView bra_bsh_tv;
    private TextView bra_lich_tv;
    private TextView bra_kaluli_tv;
    private ListView bushu_lv;
    private BraBuShuAdapter mBraBuShuAdapter;


    @Override
    protected void initView() {
        super.initView();
        FV();


    }

    @Override
    protected void initData(Bundle arguments) {
        super.initData(arguments);

        mBraBuShuAdapter=new BraBuShuAdapter(getContext());
        bushu_lv.setAdapter(mBraBuShuAdapter);
    }

    private void FV() {
        bra_bsh_tv = mRootView.findViewById(R.id.bra_bsh_tv);
        bra_lich_tv = mRootView.findViewById(R.id.bra_lich_tv);
        bra_kaluli_tv = mRootView.findViewById(R.id.bra_kaluli_tv);
        bushu_lv = mRootView.findViewById(R.id.fragment_bushu_lv);
    }




    //设置实时数据
    public void setRealTimeData(WalkBean walkBean) {
        ViewUtils.setTextViewStr(bra_bsh_tv,walkBean.steps+"");

        ViewUtils.setTextViewStr(bra_lich_tv,EHCCommonUtils.m2km2(walkBean.distance,true));
        ViewUtils.setTextViewStr(bra_kaluli_tv,(int)walkBean.calories+"");

    }

    public void SetBraTodayData(BraTodayData braTodayData) {
        if (mBraBuShuAdapter!=null){
            mBraBuShuAdapter.setDatas(braTodayData.list1);
        }
    }
}
